<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>提示</title>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta name="format-detection" content="email=no">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
    <script>window.injectInfo = { appName: "cmspromo-fallback", env: "PROD" };</script>
    <script>window.publicPath = window.__basement_public_path__ = "https://gw.alipayobjects.com/render/p/yuyan/180020010001201259/";</script>
    <script src="./vue2.6.13.min.js"></script>
    <script src="./axios.min.js"></script>
    <style>
        #app{
            padding-top: 50px;
        }
        #app img{
            width: 50px;
            height: 50px;
            margin: 0 auto;
            display: block;
        }
        #app p{
            text-align: center;
            font-size: 18px;
            font-weight: bold;
            margin: 20px 0 20px;
        }

        button{
            width: 160px;
            height: 36px;
            line-height: 36px;
            text-align: center;
            font-size: 17px;
            display: block;
            margin: 40px auto 0;
            /* padding: 8px 12px; */
            border: none;
            border-radius: 4px;
            background-color: #dda62f;
            color:#fff;
        }
    </style>
</head>

<body>
    <div id="app">
        <img src="https://jdkj-1306681707.cos.ap-nanjing.myqcloud.com/S0000260/image/imgpption_128_128_1.00_end_202508271530391944.png"
            alt="">
        <p> 支付成功 </p>
        <button @click="backToApp">返回商户APP</button>
    </div>
    <!-- <p><a href="javascript:;" class="btn" id="J-redirectBtn">点击跳转</a></p> -->
    <script>
        var baseUrl = 'https://sjx.sojiandan.com/mall'
        // var baseUrl = 'http://192.168.1.113:8096'
        var browser = {
            weChat: navigator.userAgent.indexOf("MicroMessenger") > -1, // 是否微信
            aliPay: !!navigator.userAgent.match(/Alipay/i), // 是否支付宝
        };
        var isWxMini = browser.weChat && navigator.userAgent.toLocaleLowerCase().indexOf('miniprogram') > -1
        let platform = browser.weChat ? 'wechat' : browser.aliPay ? 'alipay' : ''
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return decodeURIComponent(r[2]);
            return null;
        }

        function qsStringify(data) {
            let str = ''
            for (let key in data) {
                str += (key + '=' + data[key] + '&')
            }
            return str.slice(0, -1)
        }

        try {
            let mchData = {
                action: 'onIframeReady',
                displayStyle: 'SHOW_CUSTOM_PAGE'
            }
            let postData = JSON.stringify(mchData)
            parent.postMessage(postData, 'https://payapp.weixin.qq.com')
        } catch (err) {
            console.log(err);
        }


        new Vue({
            el: '#app',
            data() {
                return {
                    isWxMini: isWxMini,
                    platform: platform,
                    toast: '',
                    msg: '',
                    orderInfo: {},
                    orderInfoStr: ''
                }
            },
            mounted() {
                // this.msg = location.search
                // this.getOrderInfo()
            },
            methods: {
                backToApp() {
                    let url = 'xmcxzCus://'
                    fetch('https://basement-api.alipay.com/cmspromo/check?url=' + url).then((res) => {
                        return res.json();
                    }).then((res) => {
                        if (res && res.success) {
                            AlipayJSBridge.call('openInBrowser', {
                                url: decodeURIComponent(url),
                            });
                            AlipayJSBridge.call('closeWebview');
                        } else {
                            AlipayJSBridge.call('alert', {
                                message: '链接存在风险，已为您拦截',
                                button: '立即关闭'
                            }, function () {
                                AlipayJSBridge.call('closeWebview');
                            });
                        }
                    }).catch(() => {
                        // 调用失败，直接打开链接
                        AlipayJSBridge.call('openInBrowser', {
                            url: decodeURIComponent(url),
                        });
                        AlipayJSBridge.call('closeWebview');
                    });

                },
                // toast提示
                openToast(msg) {
                    let that = this
                    this.toast = msg
                    setTimeout(function () {
                        that.toast = ''
                    }, 4000)
                },
                getOrderInfo() {
                    let outTradeNo = GetQueryString('out_trade_no')
                    axios({
                        method: 'post',
                        url: baseUrl + '/pay/getOrderByOutTradeNo',
                        Headers: Headers,
                        data: qsStringify({
                            outTradeNo: outTradeNo,
                            merNo: 'S0000260',
                            // appId: 'sjxzl5692',
                            platCode: 'sjxzl5692'
                        })
                    }).then(res => {
                        if (res.data.code == 1) {
                            this.orderInfo = res.data.data
                            this.orderInfoStr = JSON.stringify(this.orderInfo)
                        } else {
                            this.openToast(res.data.msg)
                        }
                    }, err => {
                        this.openToast('网络错误')
                    })

                },
                continueSign() {
                    try {
                        let mchData = {
                            action: 'jumpOut',
                            jumpOutUrl: location.origin + '/pages/order/pay?orderNo=' + this.orderInfo.FOrderNo
                        }
                        let postData = JSON.stringify(mchData)
                        parent.postMessage(postData, 'https://payapp.weixin.qq.com')
                    } catch (err) {
                        console.log(err);
                    }

                },
                backToApp() {
                    try {
                        let mchData = {
                            action: 'jumpOut',
                            jumpOutUrl: 'xmcxzCus://'
                        }
                        let postData = JSON.stringify(mchData)
                        parent.postMessage(postData, 'https://payapp.weixin.qq.com')
                    } catch (err) {
                        console.log(err);
                    }

                },
                refreshPapge() {
                    location.reload()
                },
            }
        })

    </script>
    <!-- <script type="text/javascript">
        function bridgeReady() {
            var query = new URLSearchParams(window.location.search);
            var url = query.get('url');
            var redirectBtn = document.getElementById('J-redirectBtn');

            redirectBtn && redirectBtn.addEventListener('click', function () {
                fetch('https://basement-api.alipay.com/cmspromo/check?url=' + url).then((res) => {
                    return res.json();
                }).then((res) => {
                    if (res && res.success) {
                        AlipayJSBridge.call('openInBrowser', {
                            url: decodeURIComponent(url),
                        });
                        AlipayJSBridge.call('closeWebview');
                    } else {
                        AlipayJSBridge.call('alert', {
                            message: '链接存在风险，已为您拦截',
                            button: '立即关闭'
                        }, function () {
                            AlipayJSBridge.call('closeWebview');
                        });
                    }
                }).catch(() => {
                    // 调用失败，直接打开链接
                    AlipayJSBridge.call('openInBrowser', {
                        url: decodeURIComponent(url),
                    });
                    AlipayJSBridge.call('closeWebview');
                });
            }, false);
        }
        window.AlipayJSBridge ? bridgeReady() : document.addEventListener('AlipayJSBridgeReady', bridgeReady);
    </script> -->


</body>

</html>